from Base import message, intersect, SS_VALID
from DRG import MDCE_DRG

def group(record):
  adrg_zd = ["J68.101","J80.x00","J80.x01","J81.x00","J81.x00x002","J95.100","J95.200","J95.300","J95.800x004","J95.811","J96.000","J96.100","J96.900x001","J96.900x002","J96.900x003"]
  adrg_zd1 = []
  adrg_ss = []
  adrg_ss1 = []
  dept_list = []

  if True and record.zdList[0] in adrg_zd and (not record.ssList or not intersect(record.ssList[0],SS_VALID)):
    message('符合ER2入组条件，匹配规则：主诊断匹配')

    if MDCE_DRG.ER23_group(record):
      return 'ER23'

    if MDCE_DRG.ER25_group(record):
      return 'ER25'
        
    return 'ER2'
  else:
    return ''
    
